#include "dialog.h"
#include "./ui_dialog.h"


// #define PI 3.1415926;
const static double PI=3.1415926;
Dialog::Dialog(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::Dialog)
{
    ui->setupUi(this);
}

Dialog::~Dialog()
{
    delete ui;
}

void Dialog::on_pushButton_clicked()
{
    bool ok;
    QString tempStr;
    QString valueStr=ui->radiusLineEdit->text();
    int valueInt=valueStr.toInt(&ok);
    double area =valueInt*valueInt*PI;
    ui->areaLabel_2->setText(tempStr.setNum(area));


}


void Dialog::on_radiusLineEdit_textChanged(const QString &arg1)
{
    bool ok;
    QString tempstr;
    QString temp=ui->radiusLineEdit->text();
    int value=temp.toInt(&ok);
    double area=value*value*PI;
    ui->areaLabel_2->setText(tempstr.setNum(area));
}

